
from sympy import *

x = symbols("x")

y = x ** 2 + 4 * x + 10

# 求导数
diff_result = diff(y, x)
print(diff_result)

# 求导数方程的解
x_result = solve(diff_result)
print(x_result)

# 求解y的值
y_result = y.evalf(subs = {x : x_result[0]})

print(x_result[0], y_result)
